<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/bind-bankcard.css">
<style type="text/css">
.footer{
    display: none;
}
</style>
</block>
<block name="main">
    <ul class="list-wrapper" style="margin-top: 0.5rem">
        <li class="list-item">
            <div class="left">
                <span>姓名</span>
            </div>
            <div class="right">
                <span class="color-333">{$user_info.realname}</span>
            </div>
        </li>
        <li class="list-item">
            <div class="left">
                <span>身份证号码</span>
            </div>
            <div class="right">
                <span class="color-333">{$user_info.idcard}</span>
            </div>
        </li>
    </ul>
    <div class="form">
        <div class="form-group">
            <input type="text" id="bank_card" placeholder="请输入您的银行卡">
        </div>
        <div class="form-group">
            <input type="text" id="phone" placeholder="请输入您的预留手机号">
        </div>
    </div>
    <div class="btn-wrapper">
        <a href="javascript:" onClick="binding_bank()">保存</a>
    </div>
</block>
<block name="js">
    <script type="text/javascript">
      //绑定银行卡
        function binding_bank() {
            var bank_card = $('#bank_card').val();
            var bank_phone = $('#phone').val();

            if (bank_card == '' || bank_card == undefined || bank_card == null || bank_phone == '' || bank_phone == undefined || bank_phone == null) {
                layer.closeAll();
                layer.open({
                    content: '请输入要修改的内容'
                    ,skin: 'msg'
                    ,time: 2
                });
                return
            }

            var postdata = {
                bank_card: bank_card,
                bank_phone: bank_phone
            };
            $.post('{:U("Person/bank")}', postdata, function (res) {
                if (res.err == 0) {
                    location.href="/Home/Person/bank_success/msg/"+res.msg
                } else {
                     location.href="/Home/Person/bank_error/msg/"+res.msg
                }
            });
        }

    </script>
</block>